﻿using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Traceability.Commont.DomainEvens;
using Traceability.Commont.Domains;
using Traceability.Commont.Infrastructures.Interfaces;

namespace Traceability.Commont.DomainEvenHanders
{
    public class UserRolesCreateEvenHander : INotificationHandler<UserRolesCreateEven>
    {
        private readonly IBateRepository<UserRoles> userRoles;


        public UserRolesCreateEvenHander(IBateRepository<UserRoles> userRoles)
        {
            this.userRoles = userRoles;
        }

        public async Task Handle(UserRolesCreateEven notification, CancellationToken cancellationToken)
        {
              userRoles.Add(new UserRoles() { UserId = notification.UserId, RolesId = notification.RolesId });
        }
    }
}
